<?php
session_start();
require_once("includes/dbfunctions.php");

//TODO: Add MD5 encryption for Login

$user = userInfo($_POST['Username']);

$pass = md5($_POST['Password']);



// Also Approved Variable
if($user[6] == $pass && $user[10]== 1 )
{
setSession($user[0]);
    require ("index.php");
    exit;
}
else
{

    if($user[10] != 1)
    {
        $error = '<font color="red"> You\'re not Approved</font>';
    }
    else
    {
        $error = '<font color="red">Login failed</font>';
    }

    require("login.php");
    exit;

}


?>
